﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class YoozooManagersNetworkV2DataStructBasicPacketWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket);
			Utils.BeginObjectRegister(type, L, translator, 0, 2, 1, 1);
			
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "UpdateData", _m_UpdateData);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "Clear", _m_Clear);
			
			
			Utils.RegisterFunc(L, Utils.GETTER_IDX, "customData", _g_get_customData);
            
			Utils.RegisterFunc(L, Utils.SETTER_IDX, "customData", _s_set_customData);
            
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 3, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "Release", _m_Release_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "Get", _m_Get_xlua_st_);
            
			
            
			
			
			
            Utils.RegisterFunc(L, Utils.CLS_IDX, "New", __CreateInstanceNew);
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 1)
				{
					
					var gen_ret = new Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket constructor!");
            
        }

        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstanceNew(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 0)
				{
					
					var gen_ret = new Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket constructor!");
            
        }

        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_UpdateData(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket gen_to_be_invoked = (Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket)translator.FastGetCSObj(L, 1);
            
            
			    int gen_param_count = LuaAPI.lua_gettop(L);
            
                if(gen_param_count == 4&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)&& translator.Assignable<object>(L, 4)) 
                {
                    int _msgId = LuaAPI.xlua_tointeger(L, 2);
                    byte[] _proto = LuaAPI.lua_tobytes(L, 3);
                    object _customData = translator.GetObject(L, 4, typeof(object));
                    
                    gen_to_be_invoked.UpdateData( _msgId, _proto, _customData );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 4&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& translator.Assignable<object>(L, 3)&& translator.Assignable<object>(L, 4)) 
                {
                    int _msgId = LuaAPI.xlua_tointeger(L, 2);
                    object _message = translator.GetObject(L, 3, typeof(object));
                    object _customData = translator.GetObject(L, 4, typeof(object));
                    
                    gen_to_be_invoked.UpdateData( _msgId, _message, _customData );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 5&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TSTRING)&& translator.Assignable<Yoozoo.Managers.NetworkV2.DataStruct.IPacketHeader>(L, 5)) 
                {
                    int _msgId = LuaAPI.xlua_tointeger(L, 2);
                    string _traceId = LuaAPI.lua_tostring(L, 3);
                    byte[] _proto = LuaAPI.lua_tobytes(L, 4);
                    Yoozoo.Managers.NetworkV2.DataStruct.IPacketHeader _packetHeader = (Yoozoo.Managers.NetworkV2.DataStruct.IPacketHeader)translator.GetObject(L, 5, typeof(Yoozoo.Managers.NetworkV2.DataStruct.IPacketHeader));
                    
                    gen_to_be_invoked.UpdateData( _msgId, _traceId, _proto, _packetHeader );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket.UpdateData!");
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Clear(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket gen_to_be_invoked = (Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    
                    gen_to_be_invoked.Clear(  );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Release_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket _bp = (Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket)translator.GetObject(L, 1, typeof(Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket));
                    
                    Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket.Release( _bp );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Get_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    
                        var gen_ret = Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket.Get(  );
                        translator.Push(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_customData(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket gen_to_be_invoked = (Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket)translator.FastGetCSObj(L, 1);
                translator.PushAny(L, gen_to_be_invoked.customData);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_customData(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket gen_to_be_invoked = (Yoozoo.Managers.NetworkV2.DataStruct.BasicPacket)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.customData = translator.GetObject(L, 2, typeof(object));
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
		
		
		
		
    }
}
